package cn.iocoder.yudao.module.magic.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.ssssssss.magicapi.core.model.ApiInfo;
import org.ssssssss.magicapi.core.model.Group;
import org.ssssssss.magicapi.core.model.MagicEntity;
import org.ssssssss.magicapi.core.model.TreeNode;
import org.ssssssss.magicapi.core.service.MagicResourceService;

import java.util.List;


@Service
public class MagicApiResourcServiceImpl implements MagicApiResourcService {

    @Autowired
    MagicResourceService magicResourceService;

    @Override
    public List<MagicEntity> getApiList() {
        List<MagicEntity> apiList = magicResourceService.files("api");
        return apiList;
    }

    @Override
    public List<MagicEntity> getFunctionList() {
        List<MagicEntity> functionList = magicResourceService.files("function");
        return functionList;
    }

    @Override
    public TreeNode<Group> getApiTree() {
        TreeNode<Group> apiTree = magicResourceService.tree("api");
        return apiTree;
    }

    @Override
    public List<ApiInfo> listFiles(String groupId) {
        List<ApiInfo> apiTree = magicResourceService.listFiles(groupId);
        return apiTree;
    }
    @Override
    public TreeNode<Group> getFunctionTree() {
        TreeNode<Group> functionTree = magicResourceService.tree("function");
        return functionTree;
    }
}
